package com.goods.business.converter;

import com.goods.common.model.business.Consumer;
import com.goods.common.model.business.Product;
import com.goods.common.vo.business.ConsumerVO;
import com.goods.common.vo.business.ProductVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * projectName: goods
 *
 * @author: ysc
 * time: 2022/12/5 15:33 周一
 * description:
 */
public class ConsumerConverter {

    public static ConsumerVO converterToConsumerVO(Consumer consumer) {
        ConsumerVO consumerVO = new ConsumerVO();
        BeanUtils.copyProperties(consumer, consumerVO);
        return consumerVO;
    }
    /**
     * 转VOList
//     * @param products
     * @return
     */
    public static List<ConsumerVO> converterToVOList(List<Consumer> consumers) {
        List<ConsumerVO> consumerVOS=new ArrayList<>();
        if(!CollectionUtils.isEmpty(consumers)){
            for (Consumer consumer : consumers) {
                ConsumerVO consumerVO = converterToConsumerVO(consumer);
                consumerVOS.add(consumerVO);
            }
        }
        return consumerVOS;
    }

}
